package com.retrofit.server.processor.entity;

import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeVariableName;
import java.util.ArrayList;
import java.util.List;
import javax.lang.model.type.TypeMirror;

/**
 * @author YLG
 * @Datetime 2020/5/8-10:42 PM
 * @Version v1.0
 * @description 泛型类
 */
public class GenericEntity {

  private List<TypeName> mTypeNameList;

  private GenericEntity childGeneric;

  public GenericEntity(){
    this.mTypeNameList=new ArrayList<>();
  }

  public void addTypeMirror(TypeMirror typeMirror){
    if(typeMirror!=null){
      addTypeName(TypeName.get(typeMirror));
    }

  }

  public void addTypeName(TypeName typeName){
    this.mTypeNameList.add(typeName);
  }

  public void addTypeName(String name){
    this.addTypeName(TypeVariableName.get(name));
  }

  public void addTypeNames(List<TypeName> typeNames){
    this.mTypeNameList.addAll(typeNames);
  }

  public List<TypeName> getTypeNameList() {
    return mTypeNameList;
  }

  public void setTypeNameList(List<TypeName> typeNameList) {
    mTypeNameList = typeNameList;
  }

  public GenericEntity getChildGeneric() {
    return childGeneric;
  }

  public void setChildGeneric(GenericEntity childGeneric) {
    this.childGeneric = childGeneric;
  }
}
